UX Component 'Dirty State'

Description

Just like standard UX Components controls (such as Textbox, Textarea, RadioButton, etc), the List control is bound to a UX component variable. When the value in any control changes the UX component is considered to be 'dirty'. So for example, if you open a UX and then select a row in a List, ghe UX will go from 'clean' to 'dirty'.

In some use cases you might not want the UX go to 'dirty' when the user is making selections in a List. You can easily do this by adding some code to the onBeforeSelect and onSelect event in the List. Here is the code to add to the List's onBeforeSelect event:

var flagUXIsDirty = false;
//see if the UX is already dirty
flagUXIsDirty = {dialog.object}._dirtyRows[0];
//store the dirty state of the UX in a variable in the List object
this._flagUXIsDirty = flagUXIsDirty;

Here is the code to add to the List's onSelect event:

//if the UX was not dirty when you selected the row
//set the UX state back to clean after the row is selected.
//you need to use a timeout with a small delay.
if(this._flagUXIsDirty == false) { 
    setTimeout(function() { 
        {dialog.object}._setRowState(1,false);
    },10);
}